local skel = fk.CreateSkill {
  name = "rmt__ruzhen",
  tags = {Skill.Compulsory},
}

skel:addEffect(fk.GameStart, {
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(skel.name)
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local cards = player:drawCards(3, skel.name, "top", "@@rmt__ruzhen-inhand")
    room:setPlayerMark(player, skel.name, table.simpleClone(cards))
  end,
})

skel:addEffect(fk.RoundEnd, {
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(skel.name)
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local cards = table.filter(player:getCardIds("h"), function (id)
      return table.contains(player:getTableMark(skel.name), id)
    end)
    if #cards > 0 then
      room:recastCard(cards, player, skel.name)
    else
      cards = player:drawCards(3, skel.name, "top", "@@rmt__ruzhen-inhand")
      room:setPlayerMark(player, skel.name, table.simpleClone(cards))
    end
  end,
})

skel:addEffect("maxcards", {
  exclude_from = function(self, player, card)
    return card and card:getMark("@@rmt__ruzhen-inhand") ~= 0
  end,
})

Fk:loadTranslationTable{
  ["rmt__ruzhen"] = "入阵",
  [":rmt__ruzhen"] = "锁定技，游戏开始时，你摸三张牌并展示之；轮次结束时，你展示因“入阵”获得的牌并重铸之，若无牌可重铸，你摸三张牌并展示之。你因“入阵”获得的牌不计入手牌上限。",
  ["@@rmt__ruzhen-inhand"] = "入阵",

  ["$rmt__ruzhen1"] = "（鼓声）",
  ["$rmt__ruzhen2"] = "家事亲切，不觉遂危。",
  ["$rmt__ruzhen3"] = "兰陵亲至，贼虏得破，且速与援。",
}

return skel
